﻿using Sys.Core.Models.Dto;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using MiniFox.Components;
using MiniFox.Infrastructure;

namespace Sys.Core.Providers
{
    /// <summary>
    /// 
    /// </summary>
    [AutoRegister]
    public interface IRoleProvider
    {

        #region role
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<RoleVo>> Query(PagedQueryObject<RoleQuery> query);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        RoleVo GetRole(string roleId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        bool CreateRole(RoleDto role);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        bool UpdateRole(RoleDto role);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roles"></param>
        /// <returns></returns>
        bool DeleteRole(params string[] roles);
        #endregion

        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleName"></param>
        /// <param name="roleId">要排除的role， 传入空则表示全局查找</param>
        /// <returns></returns>
        bool IsUsedRoleName(string roleName, string roleId = null);

        #region Modules

        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="modules"></param>
        /// <returns></returns>
        bool AddModules(string roleId, params string[] modules);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="modules"></param>
        /// <returns></returns>
        bool RemoveModules(string roleId, params string[] modules);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<ModuleVo>> InclusionModules(string roleId, PagedQueryObject<ModuleQuery> request);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<ModuleVo>> ExclusionModules(string roleId, PagedQueryObject<ModuleQuery> request);
        #endregion

        #region Users
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="users"></param>
        /// <returns></returns>
        bool AddUsers(string roleId, params string[] users);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="users"></param>
        /// <returns></returns>
        bool RemoveUsers(string roleId, params string[] users);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<UserVo>> InclusionUsers(string roleId, PagedQueryObject<UserQuery> request);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="roleId"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        ResultObject<IEnumerable<UserVo>> ExclusionUsers(string roleId, PagedQueryObject<UserQuery> request);
        #endregion
    }
}
